package team.seekers.hula.island.islandNotice.service;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import team.seekers.hula.island.islandNotice.dao.IslandNoticeDao;
import team.seekers.hula.island.islandNotice.entity.dao.IslandNoticeDO;
import team.seekers.hula.island.islandNotice.entity.vo.IslandNoticeListVO;

import java.util.ArrayList;
import java.util.List;

@Service
public class IslandNoticeService {

    @Autowired
    private IslandNoticeDao islandNoticeDao;


    /**
     * 查询l浪屿公告
     */
    public List<IslandNoticeListVO> queryNoticeByIslandId(String islandId) {
        List<IslandNoticeDO> courseNoticeDOS = islandNoticeDao.lambdaQuery().eq(IslandNoticeDO::getIslandId, islandId).list();
        ArrayList<IslandNoticeListVO> islandNoticeListVOS = new ArrayList<>();
        for (IslandNoticeDO islandNoticeDD : courseNoticeDOS) {
            IslandNoticeListVO islandNoticeListVO = new IslandNoticeListVO();
            BeanUtils.copyProperties(islandNoticeDD, islandNoticeListVO);
            islandNoticeListVOS.add(islandNoticeListVO);
        }
        return islandNoticeListVOS;
    }

}
